package org.example.object.notify2;

public class Demo {
    public static void main(String[] args) {
        Buffer buffer = new Buffer();
        Producer producer = new Producer(buffer);
        Consumer consumer = new Consumer(buffer);

        new Thread(() -> {
            for (int i = 0; i < 10; i++) {
                producer.produce(i);
            }
        }).start();

        new Thread(() -> {
            for (int i = 0; i < 10; i++) {
                consumer.consume();
            }
        }).start();
    }
}
